﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    class WahAttribute : System.Attribute
    {
        private string description;

        public string Description
        {
            get { return description; }
            set { description = value; }
        }
        private string author;

        public string Author
        {
            get { return author; }
            set { author = value; }
        }
        public WahAttribute(string desc)
        {
            this.description = desc;
        }
    }

    public class Teacher
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private int age;

        public int Age
        {
            get { return age; }
            set { age = value; }
        }
        private string sex;

        public string Sex
        {
            get { return sex; }
            set { sex = value; }
        }
        //只有用户名为wah的才可以调用此方法
        [Wah("this is my attribute test", Author = "wah", Description = "test")]
        public string getMessage()
        {
            return "好好学习，天天向上";
        }
        [Wah("this is with parameters test", Author = "wanggaihui", Description = "test with parameters")]
        public int Test(int a, int b)
        {
            return a + b;
        }
    }

}
